package com.example.demomultidatasourcemybatis.controller;

import com.example.demomultidatasourcemybatis.entity.Book;
import com.example.demomultidatasourcemybatis.primary.BookMapperPrimary;
import com.example.demomultidatasourcemybatis.secondary.BookMapperSecondary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class BookController {
    @Autowired
    private BookMapperPrimary bookMapperPrimary;
    @Autowired
    private BookMapperSecondary bookMapperSecondary;

    @GetMapping("/test1")
    public List<Book> test1() {
        List<Book> books1 = bookMapperPrimary.getAll();
        return books1;
    }

    @GetMapping("/test2")
    public List<Book> test2() {
        List<Book> books2 = bookMapperSecondary.getAll();
        return books2;
    }
}
